package Frame.screen;

import FCRendering.FCRMaster;
import FCRendering.ImageUtil;
import VWorldGameStudio.events.CaseEvent;

import java.awt.*;

import static FCRendering.FCRMaster.fcv;
import static FCRendering.FCRMaster.itemLib;

public class DefaultBoxOpenScreen extends IScreen{
    @Override
    public void dispatchPaintComponent(Graphics g, FCRMaster fcrMaster) {
        // 渲染箱子界面
        if (fcv.isOpenCase()) {
            g.drawImage(ImageUtil.getImage("caseframe"), (int) (752.5 * fcv.getProportion()), (int) (403.5 * fcv.getProportion()),
                    (int) (415 * fcv.getProportion()), (int) (273 * fcv.getProportion()), this);
            CaseEvent caseEvent = (CaseEvent)fcv.getPlayingEvent();
            for (int i = 0; i < 4; i++) {
                if (caseEvent.getCaseitem()[i] != null && caseEvent.getCaseitem()[i].indexOf("null") < 0)
                    if (i != fcv.getCaseSelectNum())
                        g.drawImage(itemLib.getItemOfID(caseEvent.getCaseitem()[i]).getPngPng(),
                                (int) ((817.5 + 79 * i) * fcv.getProportion()), (int) (536.5 * fcv.getProportion()),
                                (int) (50 * fcv.getProportion()), (int) (50 * fcv.getProportion()), this);
            }
            if (fcv.getCaseSelectNum() > -1)
                g.drawImage(itemLib.getItemOfID(caseEvent.getCaseitem()[fcv.getCaseSelectNum()]).getPngPng(),
                        (int) (fcv.getMouseX() - 25 * fcv.getProportion()), (int) (fcv.getMouseY() - 25 * fcv.getProportion()),
                        (int) (50 * fcv.getProportion()), (int) (50 * fcv.getProportion()), this);
        }
    }

    @Override
    public void setBounds() {

    }
}
